package com.kczd.jinlan.adapter;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.kczd.jinlan.R;
import com.kczd.jinlan.adapter.normaladapter.BaseCommAdapter;
import com.kczd.jinlan.adapter.normaladapter.ViewHolder;
import com.kczd.jinlan.model.Goods;

import java.util.List;

/**
 * yang_g
 * 待支付 数据源
 * Created by Administrator on 2017/5/29.
 */

public class PendingPaymentAdapter extends BaseCommAdapter<Goods> {
    public PendingPaymentAdapter(List<Goods> datas) {
        super(datas);
    }

    @Override
    protected void setUI(ViewHolder holder, int position, final Context context) {
        Goods pd = getItem(position);

        TextView text_title_id = holder.getItemView(R.id.text_title_id);
        text_title_id.setText(pd.getTitle());

        TextView text_id_weight = holder.getItemView(R.id.text_id_weight);
        text_id_weight.setText(pd.getWeight_dai());

        TextView text_id_price = holder.getItemView(R.id.text_id_price);
        text_id_price.setText(pd.getPrice());

        TextView text_id_time = holder.getItemView(R.id.text_id_time);
        text_id_time.setText(pd.getPay_time());

        TextView text_id_sum = holder.getItemView(R.id.text_id_sum);
        text_id_sum.setText(pd.getCount_this());

        TextView text_id_pricesum = holder.getItemView(R.id.text_id_pricesum);
        text_id_pricesum.setText(pd.getSumprice());

        TextView text_freight = holder.getItemView(R.id.text_freight);
        text_freight.setText(pd.getYunfei());

        Button text_id_cancle = holder.getItemView(R.id.text_id_cancle);
        text_id_cancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "取消订单", Toast.LENGTH_SHORT).show();
            }
        });
        Button text_id_pay = holder.getItemView(R.id.text_id_pay);
        text_id_pay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "付款", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_list_pendingpayment;
    }
}
